from rest_framework import serializers
from .models import RestRecord

class RestRecordSerializer(serializers.ModelSerializer):
    class Meta:
        model = RestRecord
        fields = ['id', 'start_time', 'duration', 'category', 'flag', 'created_at', 'actual_duration']
        read_only_fields = ['user']  # 只加 user，不要加 actual_duration